package julienD.android;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * Gère l'affichage des items de la liste.
 * @author Julien
 *
 */
public class Liste {

	private Context context;
	private ListView listView;
	
	public Liste(Context _context, ListView _listView){
		context= _context;
		listView = _listView;
	}
	
	public void charger(List<Station> list){
	listView.setAdapter(new ArrayAdapter<String>(context, R.id.listView1,recupererNoms(list)));
	}

	private ArrayList<String> recupererNoms(List<Station> list) {
		ArrayList<String> res = new ArrayList<String>();
		for(Station station : list){
			res.add(station.getNom());
		}
		return res;
	}
}
